from mrjob.job import MRJob

class BehaviorCounter(MRJob):
    def mapper(self, _, line):
        lineinfo = line.strip().split(',')
        if len(lineinfo) == 5:
            yield lineinfo[3], 1

    def combiner(self, behaivor, counts):
        yield behaivor, sum(counts)

    def reducer(self, behaivor, counts):
        yield behaivor, sum(counts)


if __name__ == '__main__':
    BehaviorCounter.run()


